'use strict';
import {createElement, Component,render} from 'rax';
import {View,Text,Layout,Button,Link} from 'nuke';
import styles from './index.less';
const { MultiRow ,Grid,Col}  = Layout;
class ShopTitleV1 extends Component {
    constructor(props) {
      super(props);
      this.state = {
      };
    }
   handleShare(){
	   let _self = this;
	   Tida.share({
			title:_self.props.setts["shopTitle"+this.props.setts.mix], // 分享标题 在来往和微信好友中有标题显示
			content: _self.props.setts["shareContent"+this.props.setts.mix], //分享的内容
			url: _self.props.setts["shopLink"+this.props.setts.mix], // 跳转地址，分享的内容跳转的url
			image:_self.props.setts["shopIcon"+this.props.setts.mix]
		}, function(data){
			// 分享接口调用成功，在手机淘宝下面该回调仅代表API执行成功，非分享成功与否的回调。
		});
   }
   getLev(istmall,lev){
		let level;
		let level_style;
		if(istmall){
			level = "https://img.alicdn.com/imgextra/i4/27390555/TB23EJZcXT.F1JjSZFEXXc1TVXa-27390555.png";
			level_style = {width:"200rem",height:"28rem"};
		}else if(lev<10){
			level='http://a.tbcdn.cn/sys/common/icon/rank/b_1_1.gif';
			level_style = {width:"32rem",height:"32rem"};
		}else if(lev>10&&lev<=40){
			level='http://a.tbcdn.cn/sys/common/icon/rank/b_1_2.gif';
			level_style = {width:"68rem",height:"32rem"};
		}else if(lev>40&&lev<=90){
			level='http://a.tbcdn.cn/sys/common/icon/rank/b_1_3.gif';
			level_style = {width:"100rem",height:"32rem"};
		}else if(lev>90&&lev<=150){
			level='http://a.tbcdn.cn/sys/common/icon/rank/b_1_4.gif';
			level_style = {width:"132rem",height:"32rem"};
		}else if(lev>150&&lev<=250){
			level='http://a.tbcdn.cn/sys/common/icon/rank/b_1_5.gif';
			level_style = {width:"164rem",height:"32rem"};
		}else if(lev>250&&lev<=500){
			level='http://pics.taobaocdn.com/newrank/s_blue_1.gif';
			level_style = {width:"32rem",height:"32rem"};
		}else if(lev>500&&lev<=1000){
			level='http://pics.taobaocdn.com/newrank/s_blue_2.gif';
			level_style = {width:"68rem",height:"32rem"};
		}else if(lev>1000&&lev<=2000){
			level='http://pics.taobaocdn.com/newrank/s_blue_3.gif';
			level_style = {width:"100rem",height:"32rem"};
		}else if(lev>2000&&lev<=5000){
			level='http://pics.taobaocdn.com/newrank/s_blue_4.gif';
			level_style = {width:"132rem",height:"32rem"};
		}else if(lev>5000&&lev<=10000){
			level='http://pics.taobaocdn.com/newrank/s_blue_5.gif';
			level_style = {width:"164rem",height:"32rem"};
		}else if(lev>10000&&lev<=20000){
			level='http://pics.taobaocdn.com/newrank/s_cap_1.gif';
			level_style = {width:"32rem",height:"32rem"};
		}else if(lev>20000&&lev<=50000){
			level='http://pics.taobaocdn.com/newrank/s_cap_2.gif';
			level_style = {width:"68rem",height:"32rem"};
		}else if(lev>50000&&lev<=100000){
			level='http://pics.taobaocdn.com/newrank/s_cap_3.gif';
			level_style = {width:"100rem",height:"32rem"};
		}else if(lev>100000&&lev<=200000){
			level='http://pics.taobaocdn.com/newrank/s_cap_4.gif';
			level_style = {width:"132rem",height:"32rem"};
		}else if(lev>200000&&lev<=500000){
			level='http://pics.taobaocdn.com/newrank/s_cap_5.gif';
			level_style = {width:"164rem",height:"32rem"};
		}else if(lev>500000&&lev<=1000000){
			level='http://pics.taobaocdn.com/newrank/s_crown_1.gif';
			level_style = {width:"32rem",height:"32rem"};
		}else if(lev>1000000&&lev<=2000000){
			level='http://pics.taobaocdn.com/newrank/s_crown_2.gif';
			level_style = {width:"68rem",height:"32rem"};
		}else if(lev>2000000&&lev<=5000000){
			level='http://pics.taobaocdn.com/newrank/s_crown_3.gif';
			level_style = {width:"100rem",height:"32rem"};
		}else if(lev>5000000&&lev<=10000000){
			level='http://pics.taobaocdn.com/newrank/s_crown_4.gif';
			level_style = {width:"132rem",height:"32rem"};
		}else if(lev>10000000){
			level='http://pics.taobaocdn.com/newrank/s_crown_5.gif';
			level_style = {width:"164rem",height:"32rem"};
		}
		return {level,level_style}
   }
    render() {
		const {level,level_style} = this.getLev(this.props.setts["isTmall"+this.props.setts.mix],this.props.setts["shopLev"+this.props.setts.mix]);
        return (
            <Grid style={{textAlign:"left",paddingBottom:"10rem",width:'750rem',backgroundColor:this.props.setts["bgColor"+this.props.setts.mix],color:this.props.setts["color"+this.props.setts.mix]}}>
				<img src={this.props.setts["shopIcon"+this.props.setts.mix]} style={{height:"90rem",width:"90rem",marginLeft:"10rem"}} />
				<Col style={{paddingLeft:"20rem"}}>
					<Text style={{fontSize:"35rem"}}>{this.props.setts["shopTitle"+this.props.setts.mix]}</Text>
					<img src={level} style={{...level_style,marginTop:"10rem"}}  />
				</Col>
				<Link href={this.props.setts["shopLink"+this.props.setts.mix]}>
					<Text style={{...styles.textBtn,backgroundColor:this.props.setts["btnColor"+this.props.setts.mix],color:this.props.setts["btnTxtColor"+this.props.setts.mix],borderColor:this.props.setts["btnBdrColor"+this.props.setts.mix]}} >进店</Text>
				</Link>
				<Text style={{...styles.textBtn,backgroundColor:this.props.setts["btnColor"+this.props.setts.mix],color:this.props.setts["btnTxtColor"+this.props.setts.mix],borderColor:this.props.setts["btnBdrColor"+this.props.setts.mix]}} onClick={this.handleShare.bind(this)}>分享</Text>
			</Grid>
        );
    }
}

export default ShopTitleV1;
